<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-07-13 09:20:15
 * @LastEditors: maqiang
 * @LastEditTime: 2021-09-23 15:10:48
-->
<template>
  <div>
    <div class="wrapper">
      <div class="head">
        <div class="head-top">
          <div class="left">山西农业大学</div>
          <input type="text" placeholder="请输入" >
          <div class="right">学校主页</div>
          div.
        </div>
        <div class="nav">
          <div @click="toHome" class="logo"><img src="../../../public/logo.png" alt="" ></div>
          <div class="menu">
            <ul>
              <li @click="toList(c)" v-for="c in  category" :key="c.id">{{c.name}}</li>
              <!-- <li>本网首页</li>
              <li>学校要闻</li> -->
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {get} from '../../utils/request'
export default {
  data() {
    return {
      category:[]
    }
  },
  methods: {
    getCategoryData(){
      get('/index/category/findAll').then(res=>{
        this.category=res.data
      })
    },
    toList(category){
      this.$router.push({
        path:'list',
        // 传递参数
        query:category
      })
    },
    toHome(){
      this.$router.push('/');
    }
  },
  created() {
    this.getCategoryData()
  }
};
</script>

<style lang="scss" scoped>
.head {
  .head-top {
    background-color: #028b39;
    height: 50px;
    overflow: auto;
    color: white;
    input {
      float: right;
      margin-right: 20px;
      position: relative;
      top: 8px;
      height: 30px;
      width: 300px;
      border-radius: 50px;
    }
    .left {
      float: left;
      font-size: 20px;
      line-height: 50px;
      text-align: center;
      margin-left: 10px;
    }
    .right {
      float: right;
      font-size: 20px;
      line-height: 50px;
      text-align: center;
      margin-right: 10px;
    }
  }
  .nav {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    .logo {
      img {
        width: 500px;
        cursor: pointer;
      }
    }
    .menu {
      ul {
        display: flex;
        li {
          font-size: 50px;
          line-height: 100px;
          text-align: center;
          margin: 10px;
          cursor: pointer;
        }
      }
    }
  }
}
</style>